/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package telas.atualizar;

import telas.cadastra.*;
import beans.Endereco;
import beans.Funcionario;
import beans.Telefone;
import facade.FacadeAlmox;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.text.DefaultFormatterFactory;
import javax.swing.text.MaskFormatter;

/**
 *
 * @author Ronaldo
 */
public class VW_AtualizaFuncionario extends javax.swing.JFrame {

    /**
     * Creates new form VW_CadastraFuncionario
     */
    public VW_AtualizaFuncionario() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel3 = new javax.swing.JPanel();
        campo_Login = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        campo_Nome = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        campo_Email = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        selecionadoM = new javax.swing.JRadioButton();
        selecionadoF = new javax.swing.JRadioButton();
        jLabel7 = new javax.swing.JLabel();
        campo_Tel1 = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        campo_Tel2 = new javax.swing.JTextField();
        bt_SalvarPF = new javax.swing.JButton();
        jLabel9 = new javax.swing.JLabel();
        //MaskFormatter mkf = new MaskFormatter("##/##/####");
        MaskFormatter comFoco = null;
        try
        {
            comFoco = new MaskFormatter("##/##/####");
        }catch(Exception pe) { }
        DefaultFormatterFactory factory = new DefaultFormatterFactory(comFoco, comFoco);
        campo_DTNasc = new javax.swing.JFormattedTextField(comFoco);
        //new javax.swing.JFormattedTextField(mkf);//JTextField();
        campoSenha = new javax.swing.JPasswordField();
        jLabel10 = new javax.swing.JLabel();
        campo_codTel1 = new javax.swing.JTextField();
        campo_codTel2 = new javax.swing.JTextField();
        jPanel4 = new javax.swing.JPanel();
        jLabel11 = new javax.swing.JLabel();
        campoNomeEndRua = new javax.swing.JTextField();
        campoNomeEndBairro = new javax.swing.JTextField();
        campoNomeEndCidade = new javax.swing.JTextField();
        campoNomeEndCEP = new javax.swing.JTextField();
        campoNomeEndUF = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        bt_Busca = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel3.setText("Login");

        campo_Nome.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                campo_NomeActionPerformed(evt);
            }
        });

        jLabel4.setText("Nome");

        jLabel5.setText("E-mail");

        jLabel6.setText("Sexo");

        selecionadoM.setText("Masculino");
        selecionadoM.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                selecionadoMActionPerformed(evt);
            }
        });

        selecionadoF.setText("Feminino");

        jLabel7.setText("Telefone");

        jLabel8.setText("Telefone");

        campo_Tel2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                campo_Tel2ActionPerformed(evt);
            }
        });

        bt_SalvarPF.setText("Salvar");
        bt_SalvarPF.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bt_SalvarPFActionPerformed(evt);
            }
        });

        jLabel9.setText("Data Nascimento");

        campo_DTNasc.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                campo_DTNascActionPerformed(evt);
            }
        });

        jLabel10.setText("Senha");

        campo_codTel1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                campo_codTel1ActionPerformed(evt);
            }
        });

        campo_codTel2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                campo_codTel2ActionPerformed(evt);
            }
        });

        jPanel4.setBorder(new javax.swing.border.MatteBorder(null));

        jLabel11.setText("Endereço");

        campoNomeEndRua.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                campoNomeEndRuaActionPerformed(evt);
            }
        });

        campoNomeEndUF.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                campoNomeEndUFActionPerformed(evt);
            }
        });

        jLabel12.setText("Rua");

        jLabel13.setText("Bairro");

        jLabel14.setText("Cidade");

        jLabel15.setText("CEP");

        jLabel16.setText("UF");

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel4Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                                .addComponent(jLabel13)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(campoNomeEndBairro, javax.swing.GroupLayout.PREFERRED_SIZE, 167, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jLabel14)
                                .addGap(18, 18, 18)
                                .addComponent(campoNomeEndCidade, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(35, 35, 35)
                                .addComponent(jLabel15)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(campoNomeEndCEP, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addComponent(jLabel11)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel4Layout.createSequentialGroup()
                        .addGap(9, 9, 9)
                        .addComponent(jLabel12)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(campoNomeEndRua, javax.swing.GroupLayout.PREFERRED_SIZE, 486, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel16, javax.swing.GroupLayout.DEFAULT_SIZE, 20, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(campoNomeEndUF, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(9, 9, 9))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel11)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(campoNomeEndRua, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel12)
                    .addComponent(jLabel16)
                    .addComponent(campoNomeEndUF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGap(16, 16, 16)
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(campoNomeEndCidade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel14)
                            .addComponent(jLabel15)
                            .addComponent(campoNomeEndCEP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(campoNomeEndBairro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel13))))
                .addContainerGap(27, Short.MAX_VALUE))
        );

        bt_Busca.setText("Buscar");
        bt_Busca.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bt_BuscaActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(campo_codTel1, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(campo_Tel1, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jLabel7))
                        .addGap(62, 62, 62)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(campo_codTel2, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(campo_Tel2, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jLabel8))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel9)
                            .addComponent(campo_DTNasc, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap(235, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addComponent(campo_Nome, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 600, Short.MAX_VALUE)
                                .addComponent(campo_Email, javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel3Layout.createSequentialGroup()
                                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jLabel3)
                                        .addComponent(campo_Login, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(bt_Busca)
                                    .addGap(24, 24, 24)
                                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(campoSenha, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jLabel10))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jLabel6)
                                        .addGroup(jPanel3Layout.createSequentialGroup()
                                            .addComponent(selecionadoM)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                            .addComponent(selecionadoF))))
                                .addComponent(jLabel4, javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabel5, javax.swing.GroupLayout.Alignment.LEADING))
                            .addComponent(jPanel4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(bt_SalvarPF)
                .addGap(44, 44, 44))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGap(9, 9, 9)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel3)
                            .addComponent(jLabel10, javax.swing.GroupLayout.Alignment.TRAILING))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(campo_Login, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(bt_Busca)
                                .addComponent(campoSenha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(jLabel6)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(selecionadoM)
                            .addComponent(selecionadoF))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel4)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(campo_Nome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel5)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(campo_Email, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(jLabel8)
                    .addComponent(jLabel9))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(campo_Tel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(campo_Tel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(campo_DTNasc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(campo_codTel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(campo_codTel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(32, 32, 32)
                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 23, Short.MAX_VALUE)
                .addComponent(bt_SalvarPF)
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(49, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void campo_NomeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_campo_NomeActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_campo_NomeActionPerformed

    private void selecionadoMActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_selecionadoMActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_selecionadoMActionPerformed

    private void campo_Tel2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_campo_Tel2ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_campo_Tel2ActionPerformed

    private void bt_SalvarPFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bt_SalvarPFActionPerformed
        Funcionario funcionario = new Funcionario();
        funcionario.setDataNascimento(campo_DTNasc.getText());
        funcionario.setEmail(campo_Email.getText());
        if (selecionadoM.isSelected()) {
            funcionario.setSexo("M");
        } else {
            funcionario.setSexo("F");
        }
        funcionario.setLogin(campo_Login.getText());
        funcionario.setNome(campo_Nome.getText());
        funcionario.setSenha(campoSenha.getText());
        List c = new ArrayList();

        Telefone telefone = new Telefone();
        telefone.setDdd(campo_codTel1.getText());
        telefone.setNumero(campo_Tel1.getText());
        c.add(telefone);
        Telefone telefone2 = new Telefone();
        telefone2.setDdd(campo_codTel2.getText());
        telefone2.setNumero(campo_Tel2.getText());
        c.add(telefone2);
        funcionario.setTelefone(c);
        Endereco endereco = new Endereco();
        endereco.setBairro(campoNomeEndBairro.getText());
        endereco.setEstado(campoNomeEndUF.getText());
        endereco.setCep(campoNomeEndCEP.getText());
        endereco.setRua(campoNomeEndRua.getText());
        endereco.setCidade(campoNomeEndCidade.getText());
        funcionario.setEndereco(endereco);

        FacadeAlmox.getInstancia().alterarFuncionario(funcionario);
    }//GEN-LAST:event_bt_SalvarPFActionPerformed

    private void campoNomeEndRuaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_campoNomeEndRuaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_campoNomeEndRuaActionPerformed

    private void campoNomeEndUFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_campoNomeEndUFActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_campoNomeEndUFActionPerformed

    private void campo_DTNascActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_campo_DTNascActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_campo_DTNascActionPerformed

    private void campo_codTel1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_campo_codTel1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_campo_codTel1ActionPerformed

    private void campo_codTel2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_campo_codTel2ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_campo_codTel2ActionPerformed

    private void bt_BuscaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bt_BuscaActionPerformed
        Funcionario funcionario = new Funcionario();
        funcionario.setLogin(campo_Login.getText());
        funcionario = FacadeAlmox.getInstancia().consultarFuncionarioLogin(funcionario.getLogin());

        campo_Nome.setText(funcionario.getNome());
        campoSenha.setText(funcionario.getSenha());
//        campo.setText(funcionario.getSexo());
        if ( funcionario.getSexo().equals("M")|| funcionario.getSexo().equals("m") )
            selecionadoM.setSelected(true);
        else
            selecionadoF.setSelected(true);
        campo_DTNasc.setText(funcionario.getDataNascimento());

        Date data = new Date();
        String formatoData = "dd/MM/yyyy";
        SimpleDateFormat formatador = new SimpleDateFormat(formatoData);
        campo_DTNasc.setText((formatador.format(data)));
        System.out.println("Data nascimento ===>><<>> " + funcionario.getDataNascimento());
        campo_Email.setText(funcionario.getEmail());

        Endereco endereco = funcionario.getEndereco();

        campoNomeEndBairro.setText(endereco.getBairro());
        campoNomeEndCEP.setText(endereco.getCep());
        campoNomeEndCidade.setText(endereco.getCidade());
        campoNomeEndRua.setText(endereco.getRua());
        campoNomeEndUF.setText(endereco.getEstado());
        Telefone tel = new Telefone();
        ArrayList telefonep = new ArrayList();
        telefonep = (ArrayList) funcionario.getTelefone();
// for (int i = 0; i < telefonep.size(); i++) {
//                    System.out.println("Tel "+ i+ " = "+ t);
        tel = (Telefone) telefonep.get(0);
        campo_codTel1.setText(tel.getDdd());
        campo_Tel1.setText(tel.getNumero());
        tel = (Telefone) telefonep.get(1);
        campo_codTel2.setText(tel.getDdd());
        campo_Tel2.setText(tel.getNumero());
    }//GEN-LAST:event_bt_BuscaActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(VW_AtualizaFuncionario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(VW_AtualizaFuncionario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(VW_AtualizaFuncionario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(VW_AtualizaFuncionario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new VW_AtualizaFuncionario().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton bt_Busca;
    private javax.swing.JButton bt_SalvarPF;
    private javax.swing.JTextField campoNomeEndBairro;
    private javax.swing.JTextField campoNomeEndCEP;
    private javax.swing.JTextField campoNomeEndCidade;
    private javax.swing.JTextField campoNomeEndRua;
    private javax.swing.JTextField campoNomeEndUF;
    private javax.swing.JPasswordField campoSenha;
    private javax.swing.JTextField campo_DTNasc;
    private javax.swing.JTextField campo_Email;
    private javax.swing.JTextField campo_Login;
    private javax.swing.JTextField campo_Nome;
    private javax.swing.JTextField campo_Tel1;
    private javax.swing.JTextField campo_Tel2;
    private javax.swing.JTextField campo_codTel1;
    private javax.swing.JTextField campo_codTel2;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JRadioButton selecionadoF;
    private javax.swing.JRadioButton selecionadoM;
    // End of variables declaration//GEN-END:variables
}
